home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 1 / Pier Shareware 1.iso / 007a / ha0620.exe / HA0620.TXT
Text File  |  1992-10-09  |  7KB  |  125 lines

  1. ======================================================================
  2.   Microsoft(R) Product Support Services Application Note (Text File)
  3.               HA0620: Macro Assembler Questions & Answers
  4. ======================================================================
  5.                                                   Revision Date: 10/92
  6.                                                       No Disk Included
  7.  
  8. The following information applies to Microsoft Macro Assembler
  9. versions 5.1 and 6.0.
  10.  
  11.  --------------------------------------------------------------------
  12. | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
  13. | ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
  14. | Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
  15. | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
  16. | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
  17. | PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
  18. | accuracy and the use of this Application Note. This Application    |
  19. | Note may be copied and distributed subject to the following        |
  20. | conditions: 1) All text must be copied without modification and    |
  21. | all pages must be included; 2) If software is included, all files  |
  22. | on the disk(s) must be copied without modification [the MS-DOS(R)  |
  23. | utility DISKCOPY is appropriate for this purpose]; 3) All          |
  24. | components of this Application Note must be distributed together;  |
  25. | and 4) This Application Note may not be distributed for profit.    |
  26. |                                                                    |
  27. | Copyright 1992 Microsoft Corporation. All Rights Reserved.         |
  28. | Microsoft and MS-DOS are registered trademarks and Windows         |
  29. | is a trademark of Microsoft Corporation.                           |
  30.  --------------------------------------------------------------------
  31.  
  32. 1. Q. Why does my program hang or generate an illegal instruction
  33.       when I use a .386, .386P, .486, or .486P processor directive?
  34.  
  35.    A. The 386 and 486 processors can operate with either 32-bit
  36.       operations or 16-bit operations being the default. In either
  37.       mode, a prefix byte (66h or 67h) at the beginning of the
  38.       instruction tells the processor to treat an instruction as a
  39.       nondefault operation. For example, if the processor sees a prefix
  40.       byte while in a 16-bit segment, it executes the instruction as a
  41.       32-bit operation.
  42.  
  43.       When you assemble a file that uses full segment declarations,
  44.       Macro Assembler assumes that the default operations are 32 bit.
  45.       To change this assumption, you must use a USE16 modifier on the
  46.       SEGMENT directive. When you assemble a file that uses simplified
  47.       segment declarations, Macro Assembler assumes that the default
  48.       operations are 32 bit if a .386, .386P, .486, or .486P comes
  49.       before the .MODEL directive. Placing the processor directive
  50.       after the .MODEL assumes the 16-bit default operations.
  51.  
  52. 2. Q. Why can't I display my Microsoft Macro Assembler source code
  53.       under Microsoft CodeView debugger?
  54.  
  55.    A. If you are using full segment directives in your Macro Assembler
  56.       file, remember to give any code segments the class CODE. If they
  57.       are not given the class CODE, you cannot display the source file
  58.       when you enter CodeView.
  59.  
  60. 3. Q. Why do I get errors when I try to reassemble the startup
  61.       source code that came with Microsoft C version 6.0?
  62.  
  63.    A. These source files were assembled with Microsoft Macro Assembler
  64.       version 5.1 and include .INC files that were written specifically
  65.       for Macro Assembler 5.1. If you are using Macro Assembler 6.0,
  66.       you need to use the .INC files that come with Macro Assembler
  67.       6.0. Also, place /DMS_STARTUP in the flags used by the assembler
  68.       so that it uses the appropriate items out of the new .INC files.
  69.    
  70.        NOTE: These errors can also occur in Microsoft FORTRAN and
  71.        earlier versions of Microsoft C Compiler.
  72.  
  73. 4. Q. Why do I get an unresolved externals error when I link my
  74.       assembly routine with Microsoft C Compiler?
  75.  
  76.    A. Microsoft C Compiler adds leading underscores to function and
  77.       variable names and preserves the case of names. By default,
  78.       Microsoft Macro Assembler does not add a leading underscore and
  79.       converts names to all capital letters. To make the assembler
  80.       match the behavior of the C compiler, use the .MODEL directive
  81.       and specify the language. (For example, specify ".MODEL small,
  82.       c.") To make the assembler preserve the case of names, use the
  83.       /Cx assembler switch in Macro Assembler 6.0 and the /MX assembler
  84.       switch in Macro Assembler versions 5.1 and earlier.
  85.  
  86. 5. Q. Can I use Microsoft Programmer's WorkBench version 2.0,
  87.       which comes with Microsoft C/C++ Compiler version 7.0, to invoke
  88.       Microsoft Macro Assembler?
  89.  
  90.    A. Yes, you can invoke Macro Assembler 6.0 from Programmer's
  91.       WorkBench 2.0. To do this, load the Macro Assembler extension
  92.       file for Programmer's WorkBench (PWBMASM.XXT). This extension
  93.       loads automatically if it has an .MXT extension and is located in
  94.       the same directory as Programmer's WorkBench 2.0. However, this
  95.       file, which is distributed with Programmer's WorkBench 2.0,
  96.       initially has an .XXT extension. Use the MS-DOS RENAME command to
  97.       rename the file from PWBMASM.XXT to PWBMASM.MXT.
  98.    
  99.        NOTE: The .MXT files that ship with Programmer's WorkBench 1.1
  100.        do not work with Programmer's WorkBench 2.0.
  101.  
  102. 6. Q. Why can't I place code at an absolute address with the
  103.       SEGMENT AT and ORG directives?
  104.  
  105.    A. The linker that comes with Macro Assembler is designed to
  106.       generate relocatable programs that can run under MS-DOS,
  107.       Microsoft Windows, or OS/2. The linker is not designed to
  108.       generate absolute addressable code. Third-party link and locate
  109.       tools that generate absolute addressable code are available.
  110.  
  111.       The ORG directive is meant to give a relative offset to the first
  112.       items in a segment (for example, 100h for .COM files). The
  113.       SEGMENT AT directive is used when you want to access memory that
  114.       is already in the computer at an absolute address (for example,
  115.       the ROM BIOS).
  116.  
  117. 7. Q. Why does my program hang when I return from a procedure?
  118.  
  119.    A. This problem typically occurs when the stack becomes corrupt. If
  120.       you push any registers onto the stack upon entry into a
  121.       procedure, you must pop those registers off the stack upon exit
  122.       from the procedure. You must have both an equal number of pushes
  123.       and pops and a RET instruction at the end of the procedure.
  124.  
  125.